#include "LabelWidget.h"

LabelWidget::LabelWidget(const std::string& text, const Point2D& position, const Color& text_color)
    : _position(position)
{
    _rendered_text = Font::RenderText(text,text_color);
    _size = Point2D(_rendered_text->w,_rendered_text->h);
    
    _offset.x = _position.GetX();
    _offset.y = _position.GetY();
}

LabelWidget::~LabelWidget()
{
    SDL_FreeSurface(_rendered_text);
}

void LabelWidget::Render(SDL_Surface* surface)
{
    SDL_BlitSurface( _rendered_text, NULL, surface, &_offset );
}

const Point2D& LabelWidget::GetPosition() const
{
    return _position;
}

const Point2D& LabelWidget::GetSize() const
{
    return _size;
}

